using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.Web.Administration;

namespace NutriLeaf.Web
{
    public class WebRole : RoleEntryPoint
    {
        public override bool OnStart()
        {

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            return base.OnStart();
        }

        //public override bool OnStart()
        //{
        //     This only works in compute emulator.
        //     on the cloud, you might delete this code or use siteName = "Web"
        //    var siteName = "NutriLeafProject.WebApplication";

        //    using (ServerManager serverManager = new ServerManager())
        //    {
        //        foreach (Site site in serverManager.Sites)
        //        {
        //            if (site.Name.Contains(siteName))
        //            {
        //                var appPoolName = site.Applications.First().ApplicationPoolName;
        //                var appPool = serverManager.ApplicationPools[appPoolName];
        //                appPool.ProcessModel.IdentityType = ProcessModelIdentityType.ApplicationPoolIdentity;
        //            }
        //        }
        //        serverManager.CommitChanges();
        //    }

        //    return base.OnStart();
        //}
    }
}
